package lc.q150_200;

import java.util.*;
import java.util.stream.Collectors;

public class Q179 {
    public String largestNumber(int[] nums) {
        List<String> sortInteger = new ArrayList<>();
        for (int num : nums) {
            sortInteger.add(num + "");
        }
        sortInteger.sort((o1,o2) -> (o2 + o1).compareTo(o1 + o2));
        String join = String.join("", sortInteger);
        // 去掉多余的前导0
        if (join.startsWith("0")) {
            return "0";
        }
        return join;
    }

    public static void main(String[] args) {
        System.out.println(new Q179().largestNumber(new int[]{0,0,0,0,1}));
    }
}
